#ifndef _TANKMOVE_H_
#define _TANKMOVE_H_


#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<string.h>
#include "lcd_draw.h"
#include "keyboard.h"


#define UP  30
#define BULLET_NUM 20


/*
**id
**x:tank所处的横坐标
**y:tank所处的众坐标
**direction:tank的方向，0:向上，1:向下，2:向左，3:向右
**CD:tank发射子弹的冷却时间
*/
struct tank{
    char* id;
    int x;
    int y;
    int direction;
    int CD;
};

/*
**x:子弹所处的横坐标
**y:子弹所处的众坐标
**direction:子弹的方向，，0:向上，1:向下，2:向左，3:向右
**exist:子弹是否存在
**isMy:子弹是不是玩家发射的
*/
struct bullet{
    int x, y;
    int direction;
    int exist;
    int isMy;

};



//struct bullet* bulletCreate(struct tank *p);
struct tank* tankCreate(char* id, int initialX, int initialY);
void tankInitial(struct tank *p, unsigned char *A);
void moveUp(struct tank *p, unsigned char *A);
void moveDown(struct tank *p, unsigned char *A);
void moveRight(struct tank *p, unsigned char *A);
void moveLeft(struct tank *p, unsigned char *A);
void notMove(struct tank *p, unsigned char *A);
void bulletMove(struct bullet bullet[BULLET_NUM]);
void bulletCreate(struct tank *p, struct bullet bullet[BULLET_NUM], int *bullet_num);
int bulletCheck(int x, int y);
void bulletDestroy(struct bullet bullet[BULLET_NUM]);

#endif